<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Examples of Root-Finding (with and without derivatives)</title>
<link rel="stylesheet" href="../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Math Toolkit 4.1.0">
<link rel="up" href="../root_finding.html" title="Chapter 10. Root Finding &amp; Minimization Algorithms">
<link rel="prev" href="quartic_roots.html" title="Roots of Quartic Polynomials">
<link rel="next" href="root_finding_examples/cbrt_eg.html" title="Finding the Cubed Root With and Without Derivatives">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="quartic_roots.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../root_finding.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="root_finding_examples/cbrt_eg.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="math_toolkit.root_finding_examples"></a><a class="link" href="root_finding_examples.html" title="Examples of Root-Finding (with and without derivatives)">Examples of Root-Finding
    (with and without derivatives)</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="root_finding_examples/cbrt_eg.html">Finding the
      Cubed Root With and Without Derivatives</a></span></dt>
<dt><span class="section"><a href="root_finding_examples/lambda.html">Using C++11
      Lambda's</a></span></dt>
<dt><span class="section"><a href="root_finding_examples/5th_root_eg.html">Computing
      the Fifth Root</a></span></dt>
<dt><span class="section"><a href="root_finding_examples/multiprecision_root.html">Root-finding
      using Boost.Multiprecision</a></span></dt>
<dt><span class="section"><a href="root_finding_examples/nth_root.html">Generalizing
      to Compute the nth root</a></span></dt>
<dt><span class="section"><a href="root_finding_examples/elliptic_eg.html">A More
      complex example - Inverting the Elliptic Integrals</a></span></dt>
</dl></div>
<p>
      The examples demonstrate how to use the various tools for <a href="http://en.wikipedia.org/wiki/Root-finding_algorithm" target="_top">root
      finding</a>.
    </p>
<p>
      We start with the simple cube root function <code class="computeroutput"><span class="identifier">cbrt</span></code>
      ( C++ standard function name <a href="http://en.cppreference.com/w/cpp/numeric/math/cbrt" target="_top">cbrt</a>)
      showing root finding <a class="link" href="root_finding_examples/cbrt_eg.html#math_toolkit.root_finding_examples.cbrt_eg.cbrt_no_derivatives">without
      derivatives</a>.
    </p>
<p>
      We then show how use of derivatives can improve the speed of convergence.
    </p>
<p>
      (But these examples are only a demonstration and do not try to make the ultimate
      improvements of an 'industrial-strength' implementation, for example, of <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cbrt</span></code>, mainly
      by using a better computed initial 'guess' at <a href="../../../../../libs/math/include/boost/math/special_functions/cbrt.hpp" target="_top">cbrt.hpp</a>).
    </p>
<p>
      Then we show how a higher root (<a class="link" href="root_finding_examples/5th_root_eg.html" title="Computing the Fifth Root">fifth
      root</a>) <sup>5</sup>√ can be computed, and in <a href="../../../example/root_finding_n_example.cpp" target="_top">root_finding_n_example.cpp</a>
      a generic method for the <a class="link" href="root_finding_examples/nth_root.html" title="Generalizing to Compute the nth root">nth
      root</a> that constructs the derivatives at compile-time.
    </p>
<p>
      These methods should be applicable to other functions that can be differentiated
      easily.
    </p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland,
      Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno
      Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde,
      Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle
      Walker and Xiaogang Zhang<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="quartic_roots.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../root_finding.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="root_finding_examples/cbrt_eg.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
